package com.yeepal.dao;

import java.util.List;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.yeepal.bean.User;

public class UserDAO{
    private HibernateTemplate hibernateTemplate;

    public void setHibernateTemplate(HibernateTemplate hibernateTemplate){
        this.hibernateTemplate = hibernateTemplate;
    }
    public User Login(User user){
//        List list=hibernateTemplate.find("from User user where user.name='"+user.getName()+"' and user.password=md5('"+user.getPassword()+"')");
    	List list=hibernateTemplate.find("from User user where user.name='"+user.getName()+"' and user.password="+user.getPassword());
        if(list!=null && list.size()==1)
            return (User)list.get(0);
        else
            return null;
    }
}

